﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Text;
using MyLib;

namespace Portal
{
    /// <summary>
    /// SelectCar 的摘要说明
    /// </summary>
    public class SelectCar : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.ContentType = "application/json";
            string id = context.Request.QueryString["id"].ToString();
            StringBuilder strSql = new StringBuilder();
            strSql.AppendFormat("select * from WF_CARS t where t.id='{0}'", id);
            DataTable dt = DataAccess.Instance("BizDB").ExecuteDataTable(strSql.ToString());
            StringBuilder page = new StringBuilder();
            page.Append("<table class='table table-hover table-bordered table-condensed listTable' id='divCarDetails' style='width:650; margin:5% 9% 10% 9%;overflow: hidden;'>");
            page.Append("<tr><td class='td-label'>车辆名称</td><td class='td-content'>" + dt.Rows[0]["CARNAME"].ToString() + "</td>");
            page.Append("<td class='td-label'>车牌号</td><td class='td-content'>" + dt.Rows[0]["CARNUMBER"].ToString() + "</td></tr>");
            page.Append("<tr><td class='td-label'>车辆类型</td><td class='td-content'>" + dt.Rows[0]["CARTYPE"].ToString() + "</td>");
            page.Append("<td class='td-label'>可乘坐人数</td><td class='td-content'>" + dt.Rows[0]["PEOPLENUM"].ToString() + "</td></tr>");
            page.Append(" <tr><td class='td-label'>车辆识别代码</td><td class='td-content'>" + dt.Rows[0]["CARID"].ToString() + "</td>");
            page.Append("<td class='td-label'>发动机号码</td><td class='td-content'>" + dt.Rows[0]["ENGINEID"].ToString() + "</td></tr>");
            page.Append(" <tr><td class='td-label'>注册日期</td><td colspan='3' class='td-content'>" + dt.Rows[0]["REGISTERDATE"].ToString() + "</td></tr>");
            page.Append("<tr><td class='td-label'>车辆说明</td><td colspan='3' class='td-content'>" + dt.Rows[0]["CARREMARK"].ToString() + "</td></tr>");
            page.Append("</table>");
            page.Append("<div><input id='btnSure' style='width:8%;height:20;' type='button' class='btn' onclick='Sure()' value='确认' />");
            page.Append("<input id='btnCancel' style='width:8%;height:20;' type='button' class='btn' onclick='Cancel()' value='取消' /></div>");
            context.Response.Write(page.ToString());
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}